package com.xuecheng.system;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication

//@EnableDiscoveryClient(autoRegister = true);
// 开启服务自动注册功能,项目启动后能在nacos的web端界面看到服务的相关信息,并且具备拉取服务信息的功能(前提是nacos.discovery.enabled不为false)
@EnableDiscoveryClient
@MapperScan("com.xuecheng.system.mappers")
@ComponentScan(
        basePackages = {
                "com.xuecheng.system",
                "com.xuecheng.web"
        }
)
public class SystemApplication {
    public static void main(String[] args) {
        SpringApplication.run(SystemApplication.class, args);
    }
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
        return interceptor;
    }
}
